package com.chaosj.memory.command;

import com.chaosj.memory.CmdParserHandler;
import com.chaosj.webmagic.DefaultLocalFileService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.shell.standard.ShellComponent;
import org.springframework.shell.standard.ShellMethod;

/**
 * @className: ScrapeGitBookCommand
 * @description:
 * @author: caoyangjie
 * @date: 2022/3/21
 **/
@ShellComponent
public class ScrapeGitBookCommand extends AbstractCommand{
    @Value("${path.gitbook:/home/ubuntu/handbook}")
    private String gitBookBasePath;

    @ShellMethod("gitbook 爬取文件路径(https://www.bookstack.cn/read/vant-weapp-1.0.3/134d143049b98775.md)")
    public String gitbook(String url) {
        DefaultLocalFileService.set(gitBookBasePath);
        String[] args = new String[]{"gitbook", url};
        return defaultInvoke(args);
    }
}
